The present invention relates to computer systems. More specifically, the invention relates to providing end-to-end tracing for database statements in source code for database applications.
In order to analyze and optimize software applications, it can be very beneficial to track the amount of time that is spent doing various operations. For example, once an operation is identified that is taking a substantial amount (or more than expected) of time, the operation can be analyzed and optimized to reduce the amount of time.
One such software application is a database management system. Modem database applications are typically composed of clients that issue queries (and other database operations) and a server that satisfies the queries from the database. One of the most popular query languages is Structured Query Language (“SQL”), but other query languages are known.
Database clients can be written in any number of programming languages and standards exist for including SQL statements in source code. For example, SQLJ is a standard for embedding SQL statements in source code written in the Java programming language. SQLJ interacts with Java Database Connectivity (“JDBC”) in order to communicate with the database server. More specifically, JDBC provides Application Prograrnming Interfaces (“APIs”) for Java that supports SQL.
FIG. 1 shows an example of an SQL statement that is embedded in source code being satisfied by a database server. Source code 51 includes multiple source code statements. An SQL statement 53 specifies a database operation (e.g., a query) to be performed by a database server 55.
The time for executing SQL statement 53 can be associated with different functions. As shown, the time for the client can include time for assembling the SQL statement and formulating a request to the database server. Network time can include sending the query and returning the results. And time for the server can include time for parsing and executing the SQL statement and fetching the results as the client iterates the results.
Current tracing solutions provide a total time spent on the client side, server side and iterating on the results (if any). However, they do not provide a break down of the time spent in each component, which can be important to finding the component that needs optimizations or changes. Additionally, JDBC provides mechanisms for measuring performance. For example, the JDBC can provide method-level and class-level performance. However, method-level and class-level performance is not sufficient in many instances.
Accordingly, it would be beneficial to have innovative techniques for more thoroughly analyzing where time is spent in various components throughout the whole process of executing a database operation that is embedded in source code. Additionally, it would be beneficial to identify components that are causing performance problems. More specifically, it may be important to map and total database service times to specific source locations in client application code, and in addition it may prove useful to sum up service times along a hierarchical structure of the source code.